package org.keyintegrity.webbeans.metadata;

import java.io.Serializable;

public abstract class FieldMetadata implements Serializable {

    protected boolean readOnly;
    protected Appearance appearance;
    protected String typeParameter;
    protected String displayPattern;
    protected String fieldName;
    
    {
        //  Field metadata defaults
        appearance = appearance == null ? Appearance.BOTH : appearance;
    }
    
    /** Returns the suffix of field getter method - the fieldName */
    public String getFieldName() {
        return fieldName;
    }
    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }
    /** Specifies whether the field should be displayed in the Viewer/Editor modes */
    public Appearance getAppearance() {
        return appearance;
    }
    public void setAppearance(Appearance appearance) {
        this.appearance = appearance;
    }
    /** Java type specific pattern to display bean field value in the Viewer */
    public String getDisplayPattern() {
        return displayPattern;
    }
    public void setDisplayPattern(String displayPattern) {
        this.displayPattern = displayPattern;
    }
    /** Treat bean field as readOnly even in the Editor mode */
    public boolean isReadOnly() {
        return readOnly;
    }
    public void setReadOnly(boolean readOnly) {
        this.readOnly = readOnly;
    }
    /** Type parameter for java.util.List so that BeanEditor can avoid the effect of Java5 erasure strategy */
    public String getTypeParameter() {
        return typeParameter;
    }
    public void setTypeParameter(String typeParameter) {
        this.typeParameter = typeParameter;
    }
    
}
